package com.example.mobile2030606148tdh0508;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class ViewPageAdapter extends FragmentStateAdapter {
    List<Fragment>fragmentList;
    public ViewPageAdapter(@NonNull @NotNull FragmentManager fragmentManager,@NonNull @NotNull Lifecycle lifecycle,List<Fragment>fragmentList){
        super(fragmentManager,lifecycle);
        this.fragmentList=fragmentList;
    }
    @NonNull
    @org.jetbrains.annotations.NotNull
    @Override
    public Fragment createFragment(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getItemCount() {
       return fragmentList.size();
    }
}
